<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
  <img id="abc" src="/off.gif"  onclick="b()" </a>
    
</body>
<script>
    function b(){
       let a= document.querySelector("#abc");
     if(a.src.match("/off.gif")){
         a.src="/on.gif";
     }else{
         a.src="/off.gif";
     }
    }
</script>
</html>